<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%--
  Created by IntelliJ IDEA.
  User: lenovo
  Date: 2021/7/18
  Time: 13:38
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>书籍列表</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <!-- 引入 Bootstrap -->
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">

</head>
<body>

<div class="container">

    <div class="row clearfix"> <%-- 清除浮动--%>
        <div class="col-md-12 column"><%-- 把屏幕分成12分 屏幕现定义为12分 颜色--%>
            <div class="page-header">
                <h1>
                    <small>书籍列表----显示所有的书籍</small>
                </h1>
            </div>
        </div>
       </div>
            <div class="row">
            <div class="col-md-4 column">
            <a class="btn btn-primary" href="${pageContext.request.contextPath}/book/toaddBook">新增信息</a>
            </div>
                <div class="col-md-4 column"></div>
                <div class="col-md-4 column">
                   <form class="form-inline" action="${pageContext.request.contextPath}/book/queryBookName" method="post" style="float: right">
                      <span style="color: red;font-weight:bold">${error}</span>
                       <input type="text" name="queryBookName"
                       class="form-control" placeholder="请输入查询的名称">
                        <input type="submit" value="查询" class="btn btn-primary">
                   </form>
                </div>
            </div>

        <div class="row clearfix"> <%-- 清除浮动--%>
            <div class="col-md-12 column"><%-- 把屏幕分成12分 屏幕现定义为12分 颜色--%>
                <div class="page-header">
                    <table class="table table-hover table-striped">

                        <thead>
                        <tr>
                            <th>书籍编号</th>
                            <th>书籍名称</th>
                            <th>书籍数量</th>
                            <th>书籍详情</th>
                            <th>操作</th>
                        </tr>
                        <%--                     书籍从熟即可查询出来 从这个list变量出来 foreach--%>
                        </thead>
                        <c:forEach var="book" items="#{list}">
                            <tr>
                                <td>
                                        ${book.bookID}
                                </td>
                                <td>
                                        ${book.bookName}
                                </td>
                                <td>
                                        ${book.bookCounts}
                                </td>
                                <td>
                                        ${book.detail}
                                </td>
                                <td>
                                     <a href="${pageContext.request.contextPath}/book/toupdateBook?id=${book.bookID}">修改</a>
                                    &nbsp;  | &nbsp;
                                    <a href="${pageContext.request.contextPath}/book/delectBook/${book.bookID}">删除</a>
                                </td>
                            </tr>

                        </c:forEach>

                        <tbody>

                        </tbody>
                    </table>
                </div>
            </div>

        </div>


    </div>
</div>

</body>
</html>
